﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection.Emit;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using ESM.Core.Helper;
using Expression = System.Linq.Expressions.Expression;

namespace 测试表达式树
{
    /// <summary>
    /// MainWindow.xaml 的交互逻辑
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
           

        }

        private void ButtonBase_OnClick(object sender, RoutedEventArgs e)
        {
            List<Class1> list = new List<Class1>();
            for (int i = 0; i < 100; i++)
            {
                Random random = new Random(i);
                string s = random.Next(0, 100).ToString();
                list.Add(new Class1() { Name = i, Description = s });
            }
          
            Expression<Func<Class1, bool>> where = x => true;
            where= where.And(x => x.Name > 10);
            where = where.And(x => x.Name < 20);
            var d = list.Where(where.Compile());
        }
    }
}
